#ifndef BALLOC_H
#define BALLOC_H

#include <cstddef>
#define BLKSIZEARRAY 16
namespace lm1
{
	class BAlloc
	{
	private:
		union obj
		{
			union obj *next;
		};
	public:
		BAlloc();

		void *allocator(size_t size);
		void deallocator(void *ptr, size_t size);

	private:
		size_t Round_up(size_t nSize);
		size_t getHeadIndex(size_t nSize);

	private:
		static char *freepoolstart;
		static char *freepoolend;
		static int lastmallocsize;
		static union obj *blockheads[BLKSIZEARRAY];
		static const size_t blocksize[BLKSIZEARRAY];
	};
}

#endif // BALLOC_H
